package mybatis.mappers;

import models.entities.UserEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    UserEntity authenticate(@Param("email") String email, @Param("password") String password);

    void register(UserEntity user);

    UserEntity getUser(@Param("email") String email);

    UserEntity getAnonymousUser(@Param("sessionId") String sessionId);

    int addAnonymousUser(UserEntity sessionId);

    void mergeShoppingItems(@Param("anonymousUserId") int anonymousUserId, @Param("authenticatedUserId") int authenticatedUserId);

    int deleteUser(@Param("userId") int id);

    void update(UserEntity updatedUser);

    int changePassword(@Param("username") String username, @Param("password") String oldPassword, @Param("newPassword") String newPassword);

    List<String> getUserRoles(@Param("id") int id);

    List<UserEntity> getUserList(@Param("offset") int pageNumber, @Param("pageSize") int pageSize);

    int getUserListTotalCount();

    UserEntity getById(@Param("id") int id);

    void setIsAdmin(@Param("id") int id, @Param("isAdmin") boolean isAdmin);

    List<String> getAdminEmails();
}
